package com.ruoyi.common.core.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysArea;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Treeselect树结构实体类
 *
 * @author ruoyi
 */
public class TreeSelectForArea implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private String id;

    /** 节点名称 */
    private String label;

    private String grade;

    private String code;

    private String deptName;//产品名称
    private String phone;//规格型号
    private String email;//规格明细
    private String dealtype;//计量单位

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelectForArea> children;

   /* public TreeSelectForArea(){

    }

    public TreeSelectForArea(SysDept dept){
        this.id = dept.getDeptId();
        this.label = dept.getDeptName();
        this.children = dept.getChildren().stream().map(TreeSelectForArea::new).collect(Collectors.toList());
    }

    public TreeSelectForArea(SysMenu menu){
        this.id = menu.getMenuId();
        this.label = menu.getMenuName();
        this.children = menu.getChildren().stream().map(TreeSelectForArea::new).collect(Collectors.toList());
    }*/

    public TreeSelectForArea(SysArea sysArea) {
        this.id = sysArea.getDeptId();
        this.code = sysArea.getCode();
        this.label = sysArea.getDeptName();
        this.grade = sysArea.getGrade();
        this.deptName = sysArea.getDeptName();
        this.phone = sysArea.getPhone();
        this.email = sysArea.getEmail();
        this.dealtype = sysArea.getDealtype();
        this.children = sysArea.getChildren().stream().map(TreeSelectForArea::new).collect(Collectors.toList());
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getLabel()
    {
        return label;
    }

    public void setLabel(String label)
    {
        this.label = label;
    }

    public List<TreeSelectForArea> getChildren()
    {
        return children;
    }

    public void setChildren(List<TreeSelectForArea> children)
    {
        this.children = children;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getDealtype() {
        return dealtype;
    }

    public void setDealtype(String dealtype) {
        this.dealtype = dealtype;
    }
}
